package com.hongdee.scm.cockpit.controller;

import com.hongdee.scm.cockpit.service.ITScmCockpitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/9/16.
 */
@RestController
@RequestMapping("/scm/cockpit")
public class TScmCockpitController {

    @Autowired
    private ITScmCockpitService itScmCockpitService;

    /**
     * 驾驶舱车辆周报
     * @param uid
     * @param token
     * @return
     * @throws Exception
     */
    @RequestMapping("/carWeek")
    @ResponseBody
    public Map carWeek(@RequestParam(name = "uid", defaultValue = "") String uid,
                            @RequestParam(name = "token", defaultValue = "") String token)
    throws Exception{

        List list = this.itScmCockpitService.carWeek(uid);
        Map map = new HashMap();
        map.put("dataList",list);
        map.put("success",true);
        map.put("msg","查询成功");
        return map;
    }

    /**
     * 在途车辆
     * @param uid
     * @param token
     * @return
     * @throws Exception
     */
    @RequestMapping("/carOnWay")
    @ResponseBody
    public Map carOnWay(@RequestParam(name = "uid", defaultValue = "") String uid,
                       @RequestParam(name = "token", defaultValue = "") String token)
            throws Exception{

        List list = this.itScmCockpitService.carOnWay(uid);
        Map map = new HashMap();
        map.put("dataList",list);
        map.put("success",true);
        map.put("msg","查询成功");
        return map;
    }

    /**
     * 待确认出库
     * @param uid
     * @param token
     * @return
     * @throws Exception
     */
    @RequestMapping("/carOutStandBy")
    @ResponseBody
    public Map carOutStandBy(@RequestParam(name = "uid", defaultValue = "") String uid,
                             @RequestParam(name = "token", defaultValue = "") String token)
            throws Exception{

        Map mapList =  this.itScmCockpitService.carOutStandBy(uid);
        Map map = new HashMap();
        map.put("dataList",mapList);
        map.put("success",true);
        map.put("msg","查询成功");
        return map;
    }

    /**
     * 库存提醒
     * @param uid
     * @param token
     * @return
     * @throws Exception
     */
    @RequestMapping("/carStockHint")
    @ResponseBody
    public Map carStockHint(@RequestParam(name = "uid", defaultValue = "") String uid,
                             @RequestParam(name = "token", defaultValue = "") String token)
            throws Exception{

        List list = this.itScmCockpitService.carStockHint(uid);
        Map map = new HashMap();
        map.put("dataList",list);
        map.put("success",true);
        map.put("msg","查询成功");
        return map;
    }


}
